<?
/*
 * scrumbrella - Scrum board.
 *
 * Copyright (C) 2009  Gustavo N. Borgoni <gborgoni@voicemedia.com.ar>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

require_once("layout_config.php");
require_once("PHPTAL.php");

include("include/permission.php");
include("layout_config.php");

// Check for user logged in
$user_id = permission_redirect_user("index.php");

	if (!isset($_SESSION['selected'])) {
		$_SESSION['selected'] = 0;
	}

	// Load the template
	$temp = new PHPTAL('templates/main.xhtml');

	$temp->theme  = 'default';
	$temp->title  = $layout_project_name." | "._("Bienvenido");
	$temp->logout = _("Logout");

	// Tabs contnet
	$temp->home	= _("Home");
	$temp->hom_href = "home.php";
	
	$temp->project  = _("Project");
	$temp->prj_href = "projects.php";

	$temp->resource = _("Resources");
	$temp->src_href = "resources.php";

	$temp->conf     = _("Configuration");
	$temp->cfg_href = "configuration.php";

	$temp->pbacklog = _("Project backlog");
	$temp->pbl_href = "projectbacklog.php";

	$temp->task	= _("Task");
	$temp->tsk_href = "task.php";

	$temp->sprint   = _("Sprint");
	$temp->spt_href = "sprints.php";

	if ($_SESSION['project'] == "") {
		// disabled tabs
		$temp->tabs = "2, 3, 4, 5";
	} else {
		$temp->tabs = "";
	}
	// Tab selected
	$temp->selected = $_SESSION['selected'];

	// Permissions
	$temp->show_home = 1;
	$temp->show_project= 1;
	$temp->show_source=1;
	$temp->show_cfg=1;
	$temp->show_pbacklog=1;
	$temp->show_task=1;
	$temp->show_sbacklog=1;
	$temp->show_sprint=1;

	try 
	{
		echo $temp->execute();
	}

	catch(Exception $e)
	{
		echo $e;
	}
?>
